package com.dhcc.bpm.modules.log.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dhcc.bpm.modules.api.vo.ApiVO;
import com.dhcc.bpm.modules.log.entity.GatewayLog;
import com.dhcc.bpm.modules.log.entity.GatewayLogDay;
import com.dhcc.bpm.modules.log.entity.GatewayLogMinute;
import com.dhcc.bpm.modules.log.vo.GatewayLogVO;
import com.dhcc.bpm.modules.log.vo.TodayRequestNum;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @ClassName GatewayLogMapper.class
 * @Description   消网关访问记录表 Mapper 接口
 * @Author xiaFaYu
 * @Date 2019-12-16 14:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 */
public interface GatewayLogMapper extends BaseMapper<GatewayLog> {

	/**
	 * @Description 自定义分页
	 * @Author xiafayu
	 * @Date 2020/2/24 15:33
	 * @param page
	 * @param gatewayLog
	 * @return java.util.List<com.dhcc.bpm.modules.log.vo.GatewayLogVO>
	 **/
	List<GatewayLogVO> selectGatewayLogPage(IPage page, GatewayLogVO gatewayLog);
	List<GatewayLogVO> selectGatewayLogVOPage(IPage page,@Param("gatewayLog") GatewayLogVO gatewayLog);
	List<GatewayLogVO> selectGatewayLogVOByApi(IPage page,@Param("gatewayLog") GatewayLogVO gatewayLog);
	List<GatewayLogVO> selectApiByBaseProductId(  GatewayLogVO gatewayLog);
	List<GatewayLogVO> selectApiCodeBySysId(  GatewayLogVO gatewayLog);
	List<GatewayLogVO> selectApiByProductId( GatewayLogVO gatewayLog);
	List<GatewayLogVO> selectApiByApiId(  GatewayLogVO gatewayLog);
	/**
	 * @Description 查询接口访问记录
	 * @Author daina
	 * @Date 15:39 2020/3/23
	 * @param page
	 * @param gatewayLog
	 * @return java.util.List<com.dhcc.bpm.modules.log.vo.GatewayLogVO>
	 **/
	List<GatewayLogVO> listGatewayLogPage(IPage page, GatewayLogVO gatewayLog);
	/**
	 * @Description 接口执行成功次数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:33
	 * @param gatewayLog
	 * @return int
	 **/
	int selectApiSuccessCount(GatewayLog gatewayLog);

	/**
	 * @Description 接口执行失败次数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:33
	 * @param gatewayLog
	 * @return int
	 **/
	int selectApiFailCount(GatewayLog gatewayLog);

	/**
	 * @Description 接口执行失败次数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:33
	 * @param gatewayLog
	 * @return int
	 **/
	int selectFailCount(GatewayLog gatewayLog);

	/**
	 * @Description 网关异常数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:33
	 * @param gatewayLog
	 * @return int
	 **/
	int selectGateCount(GatewayLog gatewayLog);

	/**
	 * @Description 网关异常数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:33
	 * @param gatewayLog
	 * @return int
	 **/
	int gateCount(GatewayLog gatewayLog);

	/**
	 * @Description 业务异常数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:34
	 * @param gatewayLog
	 * @return int
	 **/
	int selectBusCount(GatewayLog gatewayLog);

	/**
	 * @Description 业务异常数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:34
	 * @param gatewayLog
	 * @return int
	 **/
	int busCount(GatewayLog gatewayLog);

	/**
	 * @Description 通讯异常数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:34
	 * @param gatewayLog
	 * @return int
	 **/
	int selectInfoCount(GatewayLog gatewayLog);

	/**
	 * @Description 通讯异常数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:34
	 * @param gatewayLog
	 * @return int
	 **/
	int infoCount(GatewayLog gatewayLog);

	/**
	 * @Description 某一机构下API列表以及统计信息
	 * @Author Mdd
	 * @Date 2020/3/7 17:20
	 * @param page
	 * @param api
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.api.vo.ApiVO>
	 **/
	List<ApiVO> selectOrgaApiCount(IPage<ApiVO> page, ApiVO api);

	/**
	 * @Description 某一y应用下API列表以及统计信息
	 * @Author Mdd
	 * @Date 2020/3/7 17:20
	 * @param page
	 * @param api
	 * @return com.baomidou.mybatisplus.core.metadata.IPage<com.dhcc.bpm.modules.api.vo.ApiVO>
	 **/
	List<ApiVO> selectProApiCount(IPage<ApiVO> page, ApiVO api);

	/**
	 * @Description 执行成功次数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:33
	 * @param gatewayLog
	 * @return int
	 **/
    int selectSuccessCount(GatewayLog gatewayLog);

	/**
	 * @Description 执行次数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:52
	 * @param gatewayLog
	 * @return int
	 **/
	Integer queryCount(GatewayLog gatewayLog);
	/**
	 * @Description 执行次数
	 * @Author xiafayu
	 * @Date 2020/2/24 15:52
	 * @param gatewayLog
	 * @return int
	 **/
	TodayRequestNum queryToDayCount(GatewayLog gatewayLog);

	String getDSNowDate();

	String getDSNowTime();

	String getNowTime();

	int updateMinuteData(GatewayLogMinute opcGatewayLogMinute);
	/**
	 * @param opcGatewayLog 网关访问记录信息
	 * @return java.util.List<com.ceair.openapi.portal.entity.OpcGatewayLog>
	 * @Description 查询关访问记录集合
	 * @Author LiJiaCheng
	 * @Date 2020/2/26 12:37
	 **/
	List<GatewayLog> findList(GatewayLog opcGatewayLog);

	/**
	 * @param opcGatewayLogDay 网关访问记录
	 * @return int
	 * @Description 网关访问记录--天表插值
	 * @Author LiJiaCheng
	 * @Date 2020/2/26 12:40
	 **/
	int insertDailyData(GatewayLogDay opcGatewayLogDay);

	/**
	 * @param opcGatewayLogDay 某天网关访问记录信息
	 * @return com.ceair.openapi.portal.entity.OpcGatewayLogDay
	 * @Description 查询某天网关访问记录信息
	 * @Author LiJiaCheng
	 * @Date 2020/2/26 12:40
	 **/
	GatewayLogDay findDailyData(GatewayLogDay opcGatewayLogDay);

	/**
	 * @param opcGatewayLogDay 网关访问记录（天）
	 * @return int
	 * @Description 更新网关访问记录（天）表
	 * @Author LiJiaCheng
	 * @Date 2020/2/26 12:42
	 **/
	int updateDailyData(GatewayLogDay opcGatewayLogDay);

	/**
	 * @param opcGatewayLogMinute 查询条件
	 * @return com.ceair.openapi.portal.entity.OpcGatewayLogMinute
	 * @Description 获取网关访问记录--分钟表中的信息
	 * @Author LiJiaCheng
	 * @Date 2020/2/26 12:47
	 **/
	GatewayLogMinute findMinuteData(GatewayLogMinute opcGatewayLogMinute);

	/**
	 * @param opcGatewayLogMinute 网关访问记录--分钟信息
	 * @return void
	 * @Description 网关访问记录--分钟表插值
	 * @Author LiJiaCheng
	 * @Date 2020/2/26 12:48
	 **/
	int insertMinuteData(GatewayLogMinute opcGatewayLogMinute);

	/**
	 * @param opcGatewayLog 网关访问记录
	 * @return void
	 * @Description 网关访问记录表插值
	 * @Author LiJiaCheng
	 * @Date 2020/2/26 12:50
	 **/
	int saveLog(GatewayLog opcGatewayLog);

	/**
	 * @param opcGatewayLogMinute 查询条件
	 * @return com.ceair.openapi.portal.entity.OpcGatewayLogMinute
	 * @Description 获取某天网关访问记录--分钟表中的信息
	 * @Author yzy
	 * @Date 2020/4/17 12:47
	 **/
	List<GatewayLogMinute> findMinuteList(GatewayLogMinute opcGatewayLogMinute);

	List<GatewayLogDay> findListGroup(GatewayLog opcGatewayLog);

	List<GatewayLogDay> findMinuteListGroup(GatewayLogMinute opcGatewayLog);

	String findSysName(String apiCode);

	/**
	 * @param lastDate 查询条件
	 * @return com.dhcc.bpm.modules.entity.OpcGatewayLogMinute
	 * @Description 查询历史记录表n前数据
	 * @Author xfy
	 * @Date 2022/03/24 12:47
	 **/
	List<GatewayLog> queryThirdMonthAgoLogList(@Param("lastDate") String lastDate);

	/**
	 * @param lastDate 查询条件
	 * @return com.dhcc.bpm.modules.entity.OpcGatewayLogMinute
	 * @Description 查询历史记录分钟表n前数据
	 * @Author xfy
	 * @Date 2022/03/24 12:47
	 **/
	List<GatewayLogMinute> queryThirdMonthAgoLogMinuteList(@Param("lastDate") String lastDate);

	/**
	 * @param lastDate 查询条件
	 * @return com.dhcc.bpm.modules.entity.OpcGatewayLogMinute
	 * @Description 查询历史记录天表n前数据
	 * @Author xfy
	 * @Date 2022/03/24 12:47
	 **/
	List<GatewayLogDay> queryThirdMonthAgoLogDayList(@Param("lastDate") String lastDate);
}
